package com.wsoft.hr.pm.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wsoft.hr.pm.entity.HrPmWarningEntity;
import com.wsoft.hr.pm.manager.HrPmWarningManager;
import com.wsoft.hr.pm.mapper.HrPmWarningMapper;
import com.wsoft.hr.pm.query.warning.WarningListQuery;
import com.wsoft.hr.pm.service.IHrPmWarningService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 预警表 服务实现类
 * </p>
 *
 * @author Z001
 * @since 2025年03月07日 09:44:46
 */
@Service
public class HrPmWarningServiceImpl extends ServiceImpl<HrPmWarningMapper, HrPmWarningEntity> implements IHrPmWarningService {

    @Resource
    private HrPmWarningManager warningManager;

    /**
     * 预警分页查询
     * @param query
     * @return
     */
    @Override
    public PageInfo<HrPmWarningEntity> listWarning(WarningListQuery query) {
        PageHelper.startPage(query.getPageNum(), query.getPageSize());
        List<HrPmWarningEntity> list = warningManager.list(query);
        return PageInfo.of(list);
    }

    /**
     * 获取详情
     * @param id
     * @return
     */
    @Override
    public HrPmWarningEntity getWarningInfo(Long id) {
        return warningManager.getById(id);
    }

    /**
     * 删除预警
     * @param id
     * @return
     */
    @Override
    public boolean delete(Long id) {
        return warningManager.removeById(id);
    }
}
